import Vue from 'vue'
import Router from 'vue-router'
const _import = require('./_import_' + process.env.NODE_ENV)

Vue.use(Router)

export const constantRouterMap = [
  { path: '/', component: _import('welcome'), hidden: true },
  { path: '/login', component: _import('login/login'), meta: { keepAlive: true }, hidden: true },
  { path: '/reg', component: _import('login/reg'), meta: { keepAlive: true }, hidden: true },
  { path: '/main', component: _import('main'), meta: { keepAlive: true }, hidden: true },
  { path: '/items', component: _import('products/items'), meta: { keepAlive: false }, hidden: true },
  { path: '/details', component: _import('products/details'), meta: { keepAlive: false }, hidden: true },
  { path: '/cart', component: _import('products/cart'), meta: { keepAlive: false }, hidden: true },
  { path: '/order', component: _import('products/order'), meta: { keepAlive: true }, hidden: true },
  { path: '/addlist', component: _import('products/addlist'), meta: { keepAlive: false }, hidden: true },
  { path: '/address', component: _import('products/address'), meta: { keepAlive: false }, hidden: true },
  { path: '/mycenter', component: _import('mycenter/mycenter'), meta: { keepAlive: true }, hidden: true },
  { path: '/orders', component: _import('mycenter/orders'), meta: { keepAlive: false }, hidden: true },
  { path: '/ordersdetail', component: _import('mycenter/ordersdetail'), meta: { keepAlive: false }, hidden: true },
  { path: '/member', component: _import('mycenter/member'), meta: { keepAlive: false }, hidden: true },
  { path: '/asset', component: _import('mycenter/asset'), meta: { keepAlive: false }, hidden: true },
  { path: '/news', component: _import('mycenter/news'), meta: { keepAlive: true }, hidden: true },
  { path: '/newsdetails', component: _import('mycenter/newsdetails'), meta: { keepAlive: false }, hidden: true },
  { path: '/account', component: _import('mycenter/account'), meta: { keepAlive: false }, hidden: true },
  { path: '/info', component: _import('mycenter/info'), meta: { keepAlive: true }, hidden: true },

  { path: '/orderlogin', component: _import('orderSystem/login'), meta: { keepAlive: true }, hidden: true },
  { path: '/orderbase', component: _import('orderSystem/orderbase'), meta: { keepAlive: true }, hidden: true },
  { path: '/orderdetails', component: _import('orderSystem/orderdetails'), meta: { keepAlive: false }, hidden: true },
  { path: '/orderhandle', component: _import('orderSystem/orderhandle'), meta: { keepAlive: true }, hidden: true }
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
